<!doctype html>
<html>
    <head>
        <!-- meta -->
        <!-- meta -->
        <title>API</title>
        <!-- css -->
        <link href="../styles/examples.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.common.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.kendo.css" rel="stylesheet"/>
        <!-- css -->
        <!-- script -->
        <script src="../js/jquery.js"></script>
        <script src="../../source/js/kendo.core.js"></script>
        <script src="../../source/js/kendo.popup.js"></script>
        <script src="../../source/js/kendo.data.js"></script>
        <script src="../../source/js/kendo.list.js"></script>
        <script src="../../source/js/kendo.autocomplete.js"></script>
        <!-- script -->
    </head>
    <body>
        <!-- nav -->
        <!-- nav -->
        <!-- description -->
        <div class="description">API</div>
        <!-- description -->
        <div id="example" class="k-content">

            <div class="code-sample output">
                <h4 class="code-title">Output:</h4>
                <div class="prettyprint">
                    <input id="products" />
                </div>
            </div>

            <script>
                $(document).ready(function() {
                    var data = [
                        "12 Angry Men",
                        "Il buono, il brutto, il cattivo.",
                        "Inception",
                        "One Flew Over the Cuckoo's Nest",
                        "Pulp Fiction",
                        "Schindler's List",
                        "The Dark Knight",
                        "The Godfather",
                        "The Godfather: Part II",
                        "The Shawshank Redemption"
                    ];

                    $("#products").kendoAutoComplete(data);

                    var autocomplete = $("#products").data("kendoAutoComplete"),
                        setValue = function(e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode)
                                autocomplete.value($("#value").val());
                        },
                        setSearch = function(e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode)
                                autocomplete.search($("#word").val());
                        };

                    $("#set").click(setValue);
                    $("#value").keypress(setValue);
                    $("#search").click(setSearch);
                    $("#word").keypress(setSearch);

                    $("#get").click(function() {
                        alert(autocomplete.value());
                    });
                });
           </script>

           <div class="configuration">
                <span class="configHead">Configuration</span>
                <span class="configTitle">API Functions</span>
                <ul class="options">
                    <li>
                        <input id="value" type="text" />
                        <button id="set" class="k-button">Set value</button>
                    </li>
                    <li>
                        <button id="get" class="k-button">Get value</button>
                    </li>
                    <li>
                        <input id="word" value="The" />
                        <button id="search" class="k-button">Find starting with</button>
                    </li>
                </ul>
           </div>

            <div class="code-sample">
                <h4 class="code-title">Initialization Data</h4>
                <pre class="prettyprint lang-js">
var data = [
    "12 Angry Men",
    "Il buono, il brutto, il cattivo.",
    "Inception",
    "One Flew Over the Cuckoo's Nest",
    "Pulp Fiction",
    "Schindler's List",
    "The Dark Knight",
    "The Godfather",
    "The Godfather: Part II",
    "The Shawshank Redemption"
];</pre>
            </div>

            <style scoped>
                #products {
                    margin-right: 50px;
                }

                #example .code-sample {
                    margin-top: 0;
                    width: 300px;
                }
            </style>
        </div>
        <!-- tools -->
        <!-- tools -->
    </body>
</html>
